package com.linkstec.java8;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class LocalDateTimeTest {

	private static final Logger logger = LogManager.getLogger();
	public static void main(String[] args) {
		LocalDateTime localDateTime = LocalDateTime.now();
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
		LocalDateTime aaa = LocalDateTime.parse("2020-12-04 23:59:59",dtf);
		logger.info(aaa);
		logger.info(localDateTime.getSecond());
		logger.info(localDateTime);
		
		//时间戳转LocalDateTime
		Instant instant = Instant.ofEpochMilli(1598865638000L);
		LocalDateTime time2 = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
		logger.info(time2);

		
	}

}
